﻿using System;
using System.Globalization;
using System.Windows.Data;
using Labthink.PCSoft.UniversalHost4.Utility;

namespace Labthink.PCSoft.UniversalHost4.Instrument.Converters
{
    [ValueConversion(typeof(int), typeof(string))]
    public class CupConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var cup = value.ToInt();
            var key = "Cup" + cup;
            if (Common.SelfQueryLans.ContainsKey(key)) return Common.SelfQueryLans[key];
            return key;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }
}
